package com.opengroupe.service.common;

public interface CrudService {

	/**
	 * Creates the given object into the database
	 * 
	 * @param toBePersisted
	 * @return
	 * @throws Exception 
	 */
	public Object create(Object toBePersisted) throws Exception;
	
	/**
	 * Retrieves the object of the specified type corresponding to the given id 
	 * from the database
	 * 
	 * @param objectId
	 * @param type
	 * @return
	 */
	public Object read(Object objectId, String type);
	
	
	/**
	 * Retrieves all objects of the specified type
	 * @param type
	 */
	public Object read(String type);
	
	/**
	 * Updates the given object
	 * 
	 * @param toBeUpdated
	 * @return
	 * @throws Exception 
	 */
	public Object update(Object toBeUpdated) throws Exception;
	
	/**
	 * Deletes the given object from the database
	 * 
	 * @param toBeDeleted
	 */
	public void delete(Object toBeDeleted);
}
